const router = require("express")();
const dm = require("../core/DataManager");


//获取数据库表键名映射关系
router.all("/table_key", (req, res) => res.json(dm.table_key));
//获取数据库数据实际值
router.all("/table_value", (req, res) => res.json(dm.table_value));

//聚合搜索 用户、帖子、通知(待实现)、猫咪(本地完成)
router.get('/search/:k', async (req, res) => {
    let k = req.params.k;
    if (!k) return res.json(RES_CHECKER({ success: true, result: [] }));
    let result = [...(await dm.searchUser(k)), ...(await dm.searchThread(k)),...(await dm.searchTag(k))];
    return res.json(RES_CHECKER({ success: true, result: result }));
});

router.get('/real-thread',(req,res)=>res.json(NCUTCAT.localProperty.publicContent_real_thread));

//模块导出
module.exports = router;